<?php

namespace JsonLowCode;

class NaiveUISchema extends Schema
{
    /**
     * 主题切换点击事件
     * @param bool|null $dark true|false
     * @return $this
     */
    public function toggleTheme(bool $dark = null): Schema
    {
        if ($dark!==null){
            $this->onClick("()=>{this.store.theme.setDarkMode({$dark})}");
        }else{
            $this->onClick("()=>{this.store.theme.setDarkMode(!this.store.theme.darkMode)}");
        }
        return $this;
    }
}
